package com.aatrox.bhsypro.service.impl;

import com.aatrox.bhsypro.dao.BVideoDao;
import com.aatrox.bhsypro.entity.BMySelf;
import com.aatrox.bhsypro.entity.BVideo;
import com.aatrox.bhsypro.entity.BVideo;
import com.aatrox.bhsypro.entity.LikeVideo;
import com.aatrox.bhsypro.service.BVideoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BVideoServiceImpl implements BVideoService {
    @Autowired
    BVideoDao bVideoDao;
    @Override
    public PageInfo sel(int p) {
        PageHelper.startPage(p,12);
        List list=bVideoDao.sel();
        PageInfo page=new PageInfo(list);
        return page;
    }

    @Override
    public List fy(int p) {
        return bVideoDao.fy((p-1)*12);
    }

    @Override
    public List likesel(String l,int p) {
        String s="%"+l+"%";
        List list=bVideoDao.likesel(new LikeVideo(l,(p-1)*12));
        return list;
    }

    @Override
    public PageInfo likefy(LikeVideo l) {
        PageHelper.startPage(l.getP(),12);
        List list=bVideoDao.likeselfl(new LikeVideo(l.getVTag(),0));
        PageInfo page=new PageInfo(list);
        return page;
    }

    @Override
    public BVideo selVideoForVid(int vid) {
        BVideo video =  bVideoDao.selVideoForVid(vid);
        return video;
    }
    @Override
    public List BvSel(int uid) {
        List bv = bVideoDao.BvSel(uid);
        System.out.println(bv);
        return bv;
    }


    @Override
    public BMySelf selVideoSum(int uid) {
        BMySelf bm =  bVideoDao.selVideoSum(uid);
        return bm;
    }
}
